//
//  CarDetailTableViewCell.m
//  
//
//  Created by 微 醺 on 15/10/6.
//
//

#import "CarDetailTableViewCell.h"
#import "SearchModel.h"

@implementation CarDetailTableViewCell

#pragma mark - 重写初始化方法
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.langname = [[UILabel alloc]init];
        self.value = [[UILabel alloc]init];
        self.model = [[SearchModel alloc]init];
        
        [self.contentView addSubview:self.langname];
        [self.contentView addSubview:self.value];

    }
    return self;
}

#pragma mark - 重写model类set方法
- (void)setModel:(SearchModel *)model
{
    if (_model != model)
    {
        _model = model;
    }
    
    self.langname.text = self.model.langname;
    self.value.text = self.model.value;
    
}

#pragma mark - 布局子视图
- (void)layoutSubviews
{
    AppDelegate *dele = [[UIApplication sharedApplication]delegate];
    if (dele.isNight == 1) {
        self.contentView.backgroundColor = [UIColor blackColor];
        self.langname.textColor = [UIColor whiteColor];
        
    }
    else{
        self.contentView.backgroundColor = [UIColor whiteColor];
        self.langname.textColor = [UIColor blackColor];
        
    }
    self.langname.frame = CGRectMake(20.0/375*self.frame.size.width,0, 190.0/375*self.frame.size.width, self.frame.size.height);
    self.langname.font = [UIFont systemFontOfSize:16];
    
    
    self.value.frame = CGRectMake(100.0/375*self.frame.size.width, 0, 255.0/375*self.frame.size.width, self.frame.size.height);
    self.value.textColor = [UIColor colorWithRed:36.0f/255 green:169.0f/255 blue:225.0f/255 alpha:1];
    self.value.textAlignment = 2;
    self.value.font = [UIFont systemFontOfSize:14];
    
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
